home *** CD-ROM | disk | FTP | other *** search
- /*
- File: DebuggingGear.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __DEBUGGINGGEAR__
- #define __DEBUGGINGGEAR__
-
- #ifndef __DEBUGFLAGS__
- #include "DebugFlag.h"
- #endif
-
- #ifndef __DEBUGSTREAM__
- #include "DebugStream.h"
- #endif
-
- #ifndef __EVENTS__
- #include <Events.h>
- #endif
-
- /***********************************|****************************************/
-
- #if debug
-
- // These are the various streams to which output can be sent.
- extern debugstream keith, steve, kai, chris;
- extern TDebugFlag keithFlag, steveFlag, kaiFlag, chrisFlag, addressTypesFlag, debugFlag, miscFlag;
- extern Boolean gPausing, gReadyToQuit;
-
- extern void FlushDebugBuffers ();
- extern Boolean HandleDebuggingMenuEvent (EventRecord *event);
- extern void ShowErrorIf(Boolean showError, const char* text, OSErr err);
- extern void ShowOftenMemoryInfo();
- extern Boolean MemoryInfoChanged();
- extern Boolean StackSpaceIsLow();
- extern void CheckStackSpaceAndGiveWarningIfNecessary(const StringPtr where);
-
- extern pascal void GetProcName(const void* pc, StringPtr procName);
- extern void StripArgumentsFromProcName(StringPtr procName);
-
- extern void BreakStr (const Str255 breakString);
- extern void BreakStr (const char* breakString);
-
- inline void DEBUGGER ( void )
- {
- if ( debugFlag.Flag ( 2 ) )
- Debugger ();
- };
-
- inline void DEBUGSTR ( Str255& x )
- {
- if ( debugFlag.Flag ( 2 ) )
- DebugStr ( x );
- };
-
- #define keithDB(MESSAGE) { keith << MESSAGE; keith << endl; }
- #define steveDB(MESSAGE) { steve << MESSAGE; steve << endl; }
- #define chrisDB(MESSAGE) { chris << MESSAGE; chris << endl; }
- #define breakDB(MESSAGE) { BreakStr(MESSAGE); }
-
- #define keithF(FLAG,MESSAGE) { if (keithFlag.Flag(FLAG)) { keith << MESSAGE; keith << endl; }; };
- #define steveF(FLAG,MESSAGE) { if (steveFlag.Flag(FLAG)) { steve << MESSAGE; keith << endl; }; };
- #define chrisF(FLAG,MESSAGE) { if (chrisFlag.Flag(FLAG)) { chris << MESSAGE; keith << endl; }; };
- #define debugF(FLAG,MESSAGE) { if (debugFlag.Flag(FLAG)) { keith << MESSAGE; keith << endl; }; };
- #define miscF(FLAG,MESSAGE) { if ( miscFlag.Flag(FLAG)) { keith << MESSAGE; keith << endl; }; };
-
- #else
-
- inline void DebugDebugger ( void )
- {
- };
-
- inline void DebugDebugStr ( Str255& )
- {
- };
-
- #define keithDB(MESSAGE) { }
- #define steveDB(MESSAGE) { }
- #define chrisDB(MESSAGE) { }
-
- #define keithF(FLAG,MESSAGE) { }
- #define steveF(FLAG,MESSAGE) { }
- #define chrisF(FLAG,MESSAGE) { }
- #define debugF(FLAG,MESSAGE) { }
- #define miscF(FLAG,MESSAGE) { }
-
- #endif
-
- /***********************************|****************************************/
-
- // If we're building a MPW test tool, define the streams so that they
- // are the standard output stream cerr.
- #if BLJTestTool
-
- #define keith cerr
- #define steve cerr
- #define kai cerr
- #define chris cerr
-
- #endif
-
-
- /***********************************|****************************************/
-
- #endif // __DEBUGGINGGEAR__
-